/**
 * 
 */
package com.game.jumpdino.logic.visual;

import android.content.Context;
import android.graphics.drawable.Drawable;

import com.game.jumpdino.R;

/**
 * @author HugoGu
 *
 */
public class Dragon extends Blocker {
	private Drawable altetiveImage;
	
	@Override
	public void onInitialized(Context context){
		super.onInitialized(context);
		altetiveImage = context.getResources().getDrawable(R.drawable.dragon);
	}
	
	@Override
	public void onTurnAround(){
		switchImage();
	}
	
	@Override
	public void setVx(float x){
		if (this.getVelocity().x * x < 0){
			switchImage();
		}
		super.setVx(x);
	}
	
	private void switchImage(){
		Drawable temp = image;
		image = altetiveImage;
		altetiveImage = temp;
	}
}
